package com.vue.service.impl;

import com.vue.dao.VueDao;
import com.vue.dao.VueDaoCm;
import com.vue.entity.INSBMessage;
import com.vue.entitycm.User;
import com.vue.service.VueService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2018/6/11.
 * 两个dao，连接不同的数据库
 */
@Service
public class VueServiceImpl implements VueService {

    @Resource
    private VueDaoCm<User> userDaoCm;

    @Resource
    private VueDao<INSBMessage> messageDao;

    @Override
    public User getUser(String userid) {

        User user = userDaoCm.get(User.class, userid);
        return user;
    }

    @Override
    public List getMessages() {
        List<INSBMessage> messageList = messageDao.find("from INSBMessage");
        return messageList;
    }

    @Override
    public List<User> getUser() {
        List<User> users = userDaoCm.find("from User");
        return users;
    }
}
